package com.weed.helper;

import java.util.HashMap;
import com.weed.core.WeedException;

/**
 * 函数说明:
 *     基本工厂，日志工厂基础类。
 *
 * 版本    修订人        说明
 * 0.1    Jason Zhuo    新增日志工厂
 */

public abstract class Factory {

  HashMap logMap = new HashMap();

  public Factory() {}

  public Object newInstace(String clazz) throws WeedException {
    Object obj = null;
    try {
      Class object_class = Class.forName(clazz);
      obj = object_class.newInstance();
    }
    catch (ClassNotFoundException ex) {
      Throwable cuase = ex.getCause();
      throw new WeedException(cuase);
    }
    catch (IllegalAccessException ex1) {
      Throwable cuase = ex1.getCause();
      throw new WeedException(cuase);
    }
    catch (InstantiationException ex2) {
      Throwable cuase = ex2.getCause();
      throw new WeedException(cuase);
    }
    return obj;
  }

}
